package cn.yuan.org.service;

import cn.yuan.BaseTest;
import cn.yuan.basic.util.PageList;
import cn.yuan.org.domain.Department;
import cn.yuan.org.query.DepartmentQuery;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

public class IDepartmentServiceTest extends BaseTest {
    @Autowired
    private IDepartService departService;

    @Test
    public void save(){
        Department department = new Department();
        department.setName("运维部");
        departService.save(department);
    }

    @Test
    public void remove(){
        departService.remove(47L);
    }

    @Test
    public void update(){
        Department department = new Department();
        department.setId(48L);
        department.setName("人事部");
        departService.update(department);
    }

    @Test
    public void findOne(){
        System.out.println(departService.loadById(43L));

    }

    @Test
    public void findAll(){
        List<Department> list = departService.loadAll();
        list.forEach(e-> System.out.println(e));
    }

    @Test
    public void queryForPage(){
        DepartmentQuery query = new DepartmentQuery();
        PageList<Department> list = departService.queryForPage(query);
        System.out.println(list);
    }
}
